﻿Imports System.Data.Entity

Public Class Contexto
    Inherits DbContext

    Public Sub New()
        MyBase.New("name=LomaVerdeEntities")
    End Sub

    Public Property Cliente As DbSet(Of Cliente)

    Public Property Localidad As DbSet(Of Localidad)

    Public Property Bandeja As DbSet(Of Bandeja)

    Public Property Devolucion As DbSet(Of Devolucion)

    Public Property Banco() As DbSet(Of Banco)

    Public Property BandejaCliente() As DbSet(Of BandejaCliente)

    Public Property ChequeRecibido() As DbSet(Of ChequeRecibido)

    Public Property Contrato() As DbSet(Of Contrato)

    Public Property FormaPago() As DbSet(Of FormaPago)

    Public Property Marca() As DbSet(Of Marca)

    Public Property DetalleContrato() As DbSet(Of DetalleContrato)

    Public Property Recibo() As DbSet(Of Recibo)



    Protected Overrides Sub OnModelCreating(ByVal modelBuilder As DbModelBuilder)
        MyBase.OnModelCreating(modelBuilder)

        modelBuilder.Entity(Of Recibo).HasRequired(Function(t) t.Cliente).WithRequiredPrincipal().WillCascadeOnDelete(False)

        modelBuilder.Entity(Of Recibo).HasRequired(Function(t) t.Contrato).WithRequiredPrincipal().WillCascadeOnDelete(False)

        'modelBuilder.Entity(Of Recibo).HasRequired(Function(t) t.FormaPago).WithRequiredPrincipal().WillCascadeOnDelete(False)
    End Sub
End Class
